package com.acc.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.acc.service.AuthorityService;
import com.acc.service.impl.AuthorityServiceImpl;
/**
 * 
 * @author 朱春阳
 *
 */
public class UpdateServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//设置编码格式
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		//取更新后的值
		String adminName = req.getParameter("adminName");
		String adminRole = req.getParameter("adminRole");
		
		Integer id = Integer.parseInt(req.getParameter("id"));
		
		AuthorityService authorityService = new AuthorityServiceImpl();
		authorityService.updateAdminRole(adminName, adminRole, id);
	}

}
